export default defineEventHandler(async (event) => {
  const body = await readBody(event);

  // 生成执行ID
  const executionId = `exec_${Date.now()}_${Math.random().toString(36).slice(2, 11)}`;

  // 模拟执行结果
  const execution = {
    id: executionId,
    capabilityInstanceId: body.capabilityInstanceId,
    resourceId: body.resourceId,
    status: 'completed', // 模拟立即完成
    parameters: body.parameters,
    result: {
      success: true,
      data: {
        executionId,
        timestamp: Date.now(),
        duration: Math.floor(Math.random() * 1000) + 100, // 100-1100ms
        message: '执行成功',
      },
    },
    error: null,
    startTime: Date.now(),
    endTime: Date.now() + 500, // 模拟500ms执行时间
    duration: 500,
    context: body.context,
    createTime: Date.now(),
    updateTime: Date.now(),
  };

  return {
    code: 0,
    data: execution,
    msg: '执行成功',
  };
});
